#-------------------------------------------------
#
# Project created by QtCreator 2025-07-19T13:38:38
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = qtcudaTest
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


SOURCES += \
        main.cpp \
        mainwindow.cpp \

HEADERS += \
        mainwindow.h \
    aidetectbingxingkernel.h

FORMS += \
        mainwindow.ui


# ===================== CUDA 配置 =====================
# 基本配置
QT += core gui widgets
#TARGET = YourProject
#TEMPLATE = app

# CUDA 配置 (Xavier 特定)
CUDA_DIR = /usr/local/cuda-10.2  # JetPack 4.4 默认路径

# 包含路径
INCLUDEPATH += $$CUDA_DIR/targets/aarch64-linux/include \
               /usr/include/opencv4

# 库链接
#LIBS += -L$$CUDA_DIR/targets/aarch64-linux/lib \
#        -L/usr/lib/aarch64-linux-gnu \
#        -lcudart -lcublas -lcufft -lnppial -lnppicc -lnppidei \
#        -lopencv_core -lopencv_cudaarithm

LIBS += -L$$CUDA_DIR/targets/aarch64-linux/lib \
        -L/usr/lib/aarch64-linux-gnu \
        -lcudart -lcublas -lcufft -lnppial -lnppicc -lnppidei \
        -lopencv_core

# Xavier 架构设置
#CUDA_ARCH = sm_72  # Xavier Volta 架构

# 编译器配置
#cuda.commands = $$CUDA_DIR/bin/nvcc \
#                -m64 \
#                -arch=$$CUDA_ARCH \
#                -I$$CUDA_DIR/targets/aarch64-linux/include \
#                -I/usr/include/opencv4 \
#                -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}

cuda.commands = $$CUDA_DIR/bin/nvcc \
                -I$$CUDA_DIR/targets/aarch64-linux/include \
                -I/usr/include/opencv4 \
                -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}


cuda.dependency_type = TYPE_C
cuda.input = CUDA_SOURCES
cuda.output = ${OBJECTS_DIR}/${QMAKE_FILE_BASE}.o
QMAKE_EXTRA_COMPILERS += cuda

# ARM 架构优化
#QMAKE_CFLAGS += -march=armv8-a -mtune=cortex-a57 -mstrict-align
#QMAKE_CXXFLAGS = $$QMAKE_CFLAGS

## 常规文件
#SOURCES += main.cpp \
#           mainwindow.cpp

#HEADERS += mainwindow.h \
#           aidetectbingxingkernel.h

#FORMS += mainwindow.ui

# CUDA 源文件
CUDA_SOURCES += aidetectbingxingkernel.cu
# ===================== 结束 CUDA 配置 =====================
